﻿<%@ Page Language="C#" AutoEventWireup="true" Theme="Default" CodeBehind="YongHuZLSC.aspx.cs" Inherits="Web.Pages.YongShui._1.JiChuXX.YongHuZLSC" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户资料上传</title>
    <%--<link href="../../../css/inputBgColor.css" rel="stylesheet" />--%>
    <script type="text/javascript" src="../../../JS/AddEditCancel.js"></script>
    <script src="../../../JS/jquery.js"></script>
     <%--<script src="../../../JS/Jquery-1.8.3.min.js"></script>--%>
    <link href="../../../App_Themes/Default/Default.css" rel="stylesheet" />
    <script src="../../../JS/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">

        function cmbGuanLiBMSelectedIndexChanged()
        {
            try {
                cmbGuanLiK.PerformCallback();
            } catch (e) {

            }
           
        }
        function Uploader_OnFilesUploadComplete(s, args) {
            //alert(args.callbackData);
            if (args.callbackData != "-2") {
                if (args.callbackData == "-1") {

                    alert('用户信息不存在');
                    txtYongHuH.Focus();
                }
                else {
                    alert("上传完成");
                    hdCollection.Set("yonghuh", txtYongHuH.GetText());
                    Call.PerformCallback("select");
                    grid.PerformCallback();
                   // SelectUser(s);
                }
                // alert('操作完成');
            }
            else {
               
                alert("请选择材料类别");
                cmCaiLiaoLB.Focus();
            }
        }

        function SelectUser(s,e) {
            if (event.keyCode == 13) {
                if (s.GetText() == "") {
                    alert("请输入用户号");
                    
                }
                else {
                    hdCollection.Set("yonghuh", txtYongHuH.GetText());
                    Call.PerformCallback("select");
                }
            }
        }

        function CallBackFunction(rs) {
            if (rs != "") {
                var list = rs.split('|');
                var parms = list[0];
                var type = list[1];
                if (parms == "select") {
                    if (type > 0) {
                        var yhm = list[2];
                        var dizhi = list[3];
                        var yhh = list[4];
                        $('#zjl').text(list[5]);

                            //val(list[5]);
                        //alert(list[5]);
                        txtYongHuM.SetText(yhm);
                        txtDiZhi.SetText(dizhi);
                        cmCaiLiaoLB.Focus();
                        hdCollection.Set("yonghuh", yhh);
                        hdCollection.Set("userId", list[6]);
                        grid.PerformCallback();
                    }
                    else if (type == 0) {
                        alert("用户号查询不到相关用户信息");
                        txtYongHuM.SetText("");
                        txtDiZhi.SetText("");
                        txtYongHuH.Focus();
                        hdCollection.Set("yonghuh", "");
                    }
                    else {
                        //alert("操作失败");
                        hdCollection.Set("yonghuh", "");
                    }
                }
            }
        }


        function SelectChange() {
            hdCollection.Set("cllb", cmCaiLiaoLB.GetValue());
            hdCollection.Set("cllbmc", cmCaiLiaoLB.GetText());
        }
        function CHAKANQB() {
            window.open("YongHuCLCX.aspx?yonghuh=" + txtYongHuH.GetText(), '', "width=900,height=700;");
        }

        function OpenGaoPai(s,e) {
            if (hdCollection.Get("yonghuh") == undefined) {
                alert("请输入用户号查询相关用户信息");
                txtYongHuH.Focus();
                return;
            }
            if (Number(cmCaiLiaoLB.GetValue()) <= -1) {
                alert("请选择材料类别");
                cmCaiLiaoLB.Focus();
                return;                
            }
            openCenterGaoPai("/Pages/YongShui/13.LaiHANGL/GAOPAIUPLOAD.aspx?laihanbh=&wtype=" + hdCollection.Get("wtype") + "&yonghuh=" + hdCollection.Get("yonghuh") + "&index=" + cmCaiLiaoLB.GetSelectedIndex() + "&txtvalue=" + escape(cmCaiLiaoLB.GetValue()) + "&txtname=" + escape(cmCaiLiaoLB.GetText()) + "&urltype=YHZLSC" + "&userId=" + hdCollection.Get("userId") + "", "700px", "550px");
           
        }

        function openCenterGaoPai(openUrl, iWidth, iHeight) {
            var iTop = 0; //(window.screen.availHeight - 45 - iHeight) / 2; //获得窗口的垂直位置;
            var iLeft = 0;// (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
            // window.open(openUrl, window, "dialogHeight=" + iHeight + ";dialogwidth=" + iWidth + ";dialogLeft=" + iLeft + ";dialogTop=" + iTop + ";help=no;resizable=yes;status=no;scrollbars=no;");
            window.open(openUrl, '', 'width=700,height=600');
        }

        function GaoPaiSC() {
            //BtnGPSC.OnClick(); 
            hdCollection.Set("yonghuh", txtYongHuH.GetText());
            Call.PerformCallback("select");
            grid.PerformCallback();
           // alert(2);
        }

        function rowClick() {
            if (gvList.GetFocusedRowIndex() != -1) {
                //alert(gvYongHuXX.GetRowKey(gvYongHuXX.GetFocusedRowIndex()));
                if (gvList.GetFocusedRowIndex() != -1) {
                    txtYongHuH.SetText (gvList.GetRowKey(gvList.GetFocusedRowIndex()));
                    
                    hdCollection.Set("yonghuh", txtYongHuH.GetText());
                    Call.PerformCallback("select");
                }
            }
        }
        
        $(function () {
            //$(document).on("mouseover", "#txtList", function () {
            //    $("#divChkList").slideDown("fast");
            //});
            //$(document).on("mouseleave","#divMulti",function () {
            //    $("#divChkList").slideUp("fast");
            //});
           
            $(document).on("click", "#txtList", function () {
                $("#divChkList").slideDown("fast");
            });
            $(document).on("click", "body", function () {
                //获取事件
                var e = window.event;
                //获取元素
                obj = e.target || e.srcElement;
               
                var id = $(obj).attr("id");
                id = (typeof (id) == 'undefined') ? "" : id.substring(0, id.length - 2);
                if (id == "txtList" || id == "chkList")
                {
                    return;
                }
                if ($(obj).find("label").length > 0)
                {
                    return;
                }
                var fors=$(obj).attr("for");
                fors = (typeof (fors) == 'undefined') ? "" : fors;
                if(fors.indexOf("chkList")!=-1)
                {
                    return;
                }
                $("#divChkList").slideUp("fast");

                
            });
            $(document).on("change", "#divChkList :checkbox", function () {
                //$(this).each(function () {                    
                    var txtList = $("#txtList_I");
                    if ($(this).next().text() == '全部') {
                        //if (!this.checked) {
                        if (!$(this).prop("checked")) {
                            $("#divChkList :checkbox").removeProp("checked");
                            txtList.val(' ');
                        }
                        else {
                            $("#divChkList :checkbox").prop("checked", "checked");
                            var a = '';
                            $("#divChkList :checkbox").each(function () {
                                if ($(this).next().text() != '全部') {
                                    a = a + $(this).next().text() + ",";
                                }
                            });
                            //txtList.attr("value", a);
                            txtList.val(a);
                        }
                    }
                    else {                        
                        if ($(this).prop("checked")) {
                            //txtList.attr("value", txtList.val() + $(this).next().text() + ",");
                            txtList.val(txtList.val() + $(this).next().text() + ",");
                        }
                        else {
                            //txtList.attr("value", txtList[0].value.replace($(this).next().text() + ',', ''));
                            txtList.val(txtList[0].value.replace($(this).next().text() + ',', ''));
                        }
                    }
                });
            //});
        });
    </script>

</head>
<body>
    
    <form id="form1" runat="server">
             
        <div class="tabletitle1" align="center"> 用户材料信息</div>
         <div style="display: none;">
            <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
            <dx:ASPxCallback ID="Call" ClientInstanceName="Call" 
                OnCallback="Call_Callback" 
                ClientSideEvents-CallbackComplete="function(s,e){CallBackFunction(e.result);}" 
                runat="server"></dx:ASPxCallback>
        </div>
 

        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

                <div style="float: left; width: 30%;" id="divList">

                        <table width="100%" border="0">
                            <tr>
                                <td>
                                    <table>
                                        <tr>
                                <td style="white-space: nowrap; width: 1%"><dx:ASPxLabel ID="LabGM" runat="server" Text="站点：" ClientInstanceName="LabGM"></dx:ASPxLabel>
                                </td>

                                <td style="width: 30%">
                                   <dx:ASPxComboBox runat="server" ID="cmbGuanLiBM" Width="100%" AutoPostBack="false" OnSelectedIndexChanged="cmbGuanLiBM_SelectedIndexChanged" ClientSideEvents-SelectedIndexChanged="function(s,e){cmbGuanLiBMSelectedIndexChanged();}">
                                    <Items>
                                        
                                    </Items>
                                    </dx:ASPxComboBox>
                                </td>

                                <td style="width: 20%">
                                    <span style="font-size: 12px; text-align:right;"><dx:ASPxLabel ID="labGuanLiK" runat="server" Text="管理块：" ClientInstanceName="labGuanLiK" ></dx:ASPxLabel>
                                    </span>
                                </td>

                                <td>
                                    <dx:ASPxComboBox runat="server" ID="cmbGuanLiK" Width="100%" ClientInstanceName="cmbGuanLiK" AutoPostBack="false" OnCallback="cmbGuanLiK_Callback">
                                        <Items>
                                            <dx:ListEditItem Text="全部" Value="" Selected="true"  />                                         
                                        </Items>
                                    </dx:ASPxComboBox>
                                </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>

                            <tr>
                                <td>
                                    <table>
                                        <tr>
                                            <td style="white-space: nowrap; width:35%">
                                    <dx:ASPxComboBox runat="server" ID="ASPxComboBox2" Width="100%" AutoPostBack="false">
                                    <Items>
                                        <dx:ListEditItem Text="全部" Value="" Selected="true" />
                                           <dx:ListEditItem Text="未上传" Value="0"/>
                                            <dx:ListEditItem Text="已上传" Value="1"/>
                                    </Items>
                                    </dx:ASPxComboBox>
                                    </td>
                                <td>
                                 
                                 
               
               
                      <div >
        <div id="divMulti" >
            <%--<asp:TextBox ID="txtList" runat="server" Width="160px"   CssClass="yhclxx"></asp:TextBox>--%>
            <dx:ASPxTextBox ID="txtList" ClientInstanceName="txtList1" runat="server" Width="160px"  ReadOnly="true"  ></dx:ASPxTextBox>
            
            <div id="divChkList" style="display: none; border: solid 1px #CCCCCC; position: fixed;
                z-index: 100; height: 160px; width: 160px; overflow-y: scroll; background-color: White">
                <asp:CheckBoxList ID="chkList" runat="server" RepeatLayout="Table" RepeatDirection="Vertical" >
                </asp:CheckBoxList>
            </div>
        </div>
    </div>
                       
                                </td>
                               <td>
                                     <dx:ASPxButton ID="btnSearch" ClientInstanceName="btnSearch" 
                                         runat="server" Text="查询" UseSubmitBehavior="false" 
                                         AutoPostBack="false" OnClick="btnSearch_Click">
                                          <ClientSideEvents Click="function(s,e){loadpanel1.Show(); }"/>
                                    </dx:ASPxButton>
                                </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>


                         <asp:UpdatePanel runat="server" ID="UpdatePanel2">

                            <ContentTemplate>
                                <dx:ASPxGridView ID="gvList" ClientInstanceName="gvList" runat="server" AutoGenerateColumns="False" KeyFieldName="用户号" Theme="Aqua1"
                                    Width="100%">
                                    <Columns>
                                        <dx:GridViewDataTextColumn FieldName="用户号" Caption="用户号" Width="25%" VisibleIndex="1">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="用户名" Caption="用户名" Width="55%" VisibleIndex="2">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="管理块" Caption="管理块" Width="30%" VisibleIndex="3">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="S_XINGZHENGQM" Caption="行政区" Width="30%" VisibleIndex="4">
                                        </dx:GridViewDataTextColumn>
                                    </Columns>
                                     <SettingsBehavior AllowFocusedRow="True" ProcessFocusedRowChangedOnServer="false" />
                                    <Settings VerticalScrollableHeight="500" VerticalScrollBarMode="Auto" />
                                     <Settings VerticalScrollBarMode="Visible"  HorizontalScrollBarMode="Auto" />
                                        <SettingsPager   Mode="EndlessPaging" PageSize="20"  />
                                        
                                        <SettingsBehavior AllowFocusedRow="True"  ColumnResizeMode="Control" />
                                    <ClientSideEvents FocusedRowChanged="function(s,e){
rowClick();
}" />
                                </dx:ASPxGridView>                
                            </ContentTemplate>
                              
                         </asp:UpdatePanel>
                    <dx:ASPxLabel ID="aspXCount" Text="共0条" runat="server" ForeColor="Blue"></dx:ASPxLabel>
                         <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="loadpanel1" runat="server" ContainerElementID="gvList" Modal="true" Theme="Metropolis" Text=""></dx:ASPxLoadingPanel>
                        <dx:ASPxLoadingPanel ID="ASPxLoadingPanel2" ClientInstanceName="loadpanel2" runat="server"  Text="加载中..."></dx:ASPxLoadingPanel>
                    </div>

                 <div style="float: left; width: 1%;">&nbsp;</div>

                <div style="float: left; width: 69%; overflow: auto;">
                    
                    <div style="display: none">
                        <dx:ASPxButton ID="BtnGPSC" ClientInstanceName="BtnGPSC" runat="server" OnClick="BtnGPSC_Click" UseSubmitBehavior="false" Text="高拍">
                        </dx:ASPxButton>
                    </div>

                    

                    <table style="width: 99%; margin: 0px auto">
                        <tr>
                            <td class="auto-style3">用户号：</td>
                            <td class="auto-style4">
                                <table>
                                    <tr>
                                        <td>
                                            <dx:ASPxTextBox ID="txtYongHuH" ClientInstanceName="txtYongHuH" runat="server" Width="170px" MaxLength="7">
                                            <ClientSideEvents KeyPress="function(s,e){SelectUser(s,e);}" /> </dx:ASPxTextBox>
                                        </td>
                                        <td style="width:95%; color: #FF0000;">

                                           <dx:ASPxLabel runat="server" ID="zjl" ClientInstanceName="zjl" Text=""  ></dx:ASPxLabel>
                                            <%--//<label id="zjl" style="color:red;"></label>--%>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>用户名：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtYongHuM" ClientInstanceName="txtYongHuM" ReadOnly="true" runat="server" Width="80%"></dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>地址：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtDiZhi" ClientInstanceName="txtDiZhi" ReadOnly="true" runat="server" Width="80%"></dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>材料类别：</td>
                            <td>
                                <dx:ASPxComboBox ID="cmCaiLiaoLB" ClientInstanceName="cmCaiLiaoLB" runat="server" Width="50%" ValueType="System.String">
                                    <ClientSideEvents SelectedIndexChanged="function(s,e){SelectChange();}" />
                                </dx:ASPxComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td>文件上传：</td>
                            <td>
                                <table style="width: 100%" border="0">
                                    <tr>
                                        <td style="width:30%">
                                            <dx:ASPxUploadControl ID="UpLoadFile" runat="server" ClientInstanceName="uploader"
                                                Theme="Aqua" ShowClearFileSelectionButton="False"
                                                ShowProgressPanel="True" NullText="请选择上传文件" OnFileUploadComplete="UpLoadFile_FileUploadComplete"
                                                Width="98%">
                                                <BrowseButton Text="上传"></BrowseButton>
                                                <ClientSideEvents FileUploadComplete="function(s, e) { Uploader_OnFilesUploadComplete(s,e); }"
                                                    TextChanged="function(s, e) { uploader.Upload();}"></ClientSideEvents>
                                                <ValidationSettings MaxFileSize="10485760">
                                                </ValidationSettings>
                                            </dx:ASPxUploadControl>
                                             </td>
                                        <td style="width:50px">
                                            <dx:ASPxButton ID="BtnGP" AutoPostBack="false" runat="server" Style="margin-right: 5px;" UseSubmitBehavior="false" Text="高拍">
                                                <ClientSideEvents Click="function(s,e){OpenGaoPai(s,e)}" />
                                            </dx:ASPxButton>

                                        </td>
                                        <td style="color:red">文件大小10M以内</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">相关材料：</td>
                            <td>
                                <dx:ASPxGridView ID="gvLH" ClientInstanceName="grid" 
                                    OnCustomCallback="gvLH_CustomCallback"
                                     runat="server"
                                     AutoGenerateColumns="False" 
                                     ClientSideEvents-CallbackComplete="function(s,e){CallBackFunction1(e.result);}" 
                                    KeyFieldName="ID" Width="100%" Theme="Aqua1">
                                    <EditFormLayoutProperties ColCount="3">
                                    </EditFormLayoutProperties>
                                    <Columns>

                                        <dx:GridViewDataTextColumn FieldName="S_WENJIANMC" Caption="文件名称" Width="70%" HeaderStyle-HorizontalAlign="Center">
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="USERNAME" Caption="操作人" Width="10%" HeaderStyle-HorizontalAlign="Center">
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="D_CAOZUORQ" PropertiesTextEdit-DisplayFormatString="{0:yyyy-MM-dd}" Caption="操作时间" Width="10%" HeaderStyle-HorizontalAlign="Center">
                                            <PropertiesTextEdit DisplayFormatString="{0:yyyy-MM-dd}">
                                            </PropertiesTextEdit>
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Caption="操作" Width="10%" CellStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                                            <DataItemTemplate>
                                                <a href="<%#Eval("S_WENJIANLJ") %>" target="_blank">查看</a>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <CellStyle HorizontalAlign="Center">
                                            </CellStyle>
                                        </dx:GridViewDataTextColumn>
                                    </Columns>
                                    <SettingsBehavior AllowSort="false" />
                                    <Settings  VerticalScrollableHeight="350" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />

                                </dx:ASPxGridView>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <dx:ASPxButton ID="BtnQB" runat="server" Text="查看全部上传资料" AutoPostBack="false"
                                    UseSubmitBehavior="false">
                                    <ClientSideEvents Click="function(s, e) { CHAKANQB(); }" />
                                </dx:ASPxButton>
                                <%--<a href="YongHuCLCX.aspx"> 查看全部</a>--%>
                            </td>
                            <td></td>
                        </tr>
                    </table>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
